package com.youyi.yyviewsdklibrary.Dialog.widget;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.os.Bundle;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.widget.FrameLayout;
import com.youyi.yyviewsdklibrary.Dialog.util.XPopupUtils;

public class BubbleLayout extends FrameLayout {
    public int arrowOffset;
    boolean isLookPositionCenter;
    private int mArrowDownLeftRadius;
    private int mArrowDownRightRadius;
    private int mArrowTopLeftRadius;
    private int mArrowTopRightRadius;
    private int mBottom;
    private int mBubbleBgRes;
    private int mBubbleBorderColor;
    private Paint mBubbleBorderPaint;
    private int mBubbleBorderSize;
    private int mBubbleColor;
    private Bitmap mBubbleImageBg;
    private Paint mBubbleImageBgBeforePaint;
    private RectF mBubbleImageBgDstRectF;
    private Paint mBubbleImageBgPaint;
    private Rect mBubbleImageBgSrcRect;
    private int mBubblePadding;
    private int mBubbleRadius;
    private int mHeight;
    private int mLDR;
    private int mLTR;
    private int mLeft;
    private Look mLook;
    public int mLookLength;
    public int mLookPosition;
    public int mLookWidth;
    private Paint mPaint;
    private Path mPath;
    private int mRDR;
    private int mRTR;
    private int mRight;
    private int mShadowColor;
    private int mShadowRadius;
    private int mShadowX;
    private int mShadowY;
    private int mTop;
    private int mWidth;

    public enum Look {
        LEFT(1),
        TOP(2),
        RIGHT(3),
        BOTTOM(4);
        
        int value;

        private Look(int i) {
            this.value = i;
        }

        public static Look getType(int i) {
            Look look = BOTTOM;
            if (i == 1) {
                return LEFT;
            }
            if (i == 2) {
                return TOP;
            }
            if (i != 3) {
                return look;
            }
            return RIGHT;
        }
    }

    public BubbleLayout(Context context) {
        this(context, null);
    }

    public BubbleLayout(Context context, AttributeSet attributeSet) {
        this(context, attributeSet, 0);
    }

    public BubbleLayout(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        this.mLDR = -1;
        this.mBubbleBgRes = -1;
        this.mBubbleImageBg = null;
        this.mBubbleImageBgDstRectF = new RectF();
        this.mBubbleImageBgSrcRect = new Rect();
        this.mBubbleImageBgPaint = new Paint(5);
        this.mBubbleImageBgBeforePaint = new Paint(5);
        this.mBubbleBorderColor = -16777216;
        this.mBubbleBorderSize = 0;
        this.mBubbleBorderPaint = new Paint(5);
        this.arrowOffset = 0;
        setLayerType(1, null);
        setWillNotDraw(false);
        initAttr();
        Paint paint = new Paint(5);
        this.mPaint = paint;
        paint.setStyle(Paint.Style.FILL);
        this.mPath = new Path();
        this.mBubbleImageBgPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
    }


    public void initPadding() {
        int i = this.mBubblePadding + this.mShadowRadius;
        int i2 = this.mLook.ordinal();
        if (i2 == 1) {
            setPadding(i, i, this.mShadowX + i, this.mLookLength + i + this.mShadowY);
        } else if (i2 == 2) {
            setPadding(i, this.mLookLength + i, this.mShadowX + i, this.mShadowY + i);
        } else if (i2 == 3) {
            setPadding(this.mLookLength + i, i, this.mShadowX + i, this.mShadowY + i);
        } else if (i2 == 4) {
            setPadding(i, i, this.mLookLength + i + this.mShadowX, this.mShadowY + i);
        }
    }

    private void initAttr() {
        this.mLook = Look.BOTTOM;
        this.mLookPosition = 0;
        this.mLookWidth = XPopupUtils.dp2px(getContext(), 10.0f);
        this.mLookLength = XPopupUtils.dp2px(getContext(), 9.0f);
        this.mShadowRadius = 0;
        this.mShadowX = 0;
        this.mShadowY = 0;
        this.mBubbleRadius = XPopupUtils.dp2px(getContext(), 8.0f);
        this.mLTR = -1;
        this.mRTR = -1;
        this.mRDR = -1;
        this.mLDR = -1;
        this.mArrowTopLeftRadius = XPopupUtils.dp2px(getContext(), 1.0f);
        this.mArrowTopRightRadius = XPopupUtils.dp2px(getContext(), 1.0f);
        this.mArrowDownLeftRadius = XPopupUtils.dp2px(getContext(), 1.0f);
        this.mArrowDownRightRadius = XPopupUtils.dp2px(getContext(), 1.0f);
        this.mBubblePadding = XPopupUtils.dp2px(getContext(), 0.0f);
        this.mShadowColor = -12303292;
        this.mBubbleColor = Color.parseColor("#3b3c3d");
        this.mBubbleBorderColor = 0;
        this.mBubbleBorderSize = 0;
    }

    /* access modifiers changed from: protected */
    public void onSizeChanged(int i, int i2, int i3, int i4) {
        super.onSizeChanged(i, i2, i3, i4);
        this.mWidth = i;
        this.mHeight = i2;
        initData();
    }

    public void invalidate() {
        initData();
        super.invalidate();
    }

    public void postInvalidate() {
        initData();
        super.postInvalidate();
    }

    private void initData() {
        int i;
        int i2;
        initPadding();
        if (this.isLookPositionCenter) {
            if (this.mLook == Look.LEFT || this.mLook == Look.RIGHT) {
                i2 = this.mHeight / 2;
                i = this.mLookLength;
            } else {
                i2 = this.mWidth / 2;
                i = this.mLookWidth;
            }
            this.mLookPosition = i2 - (i / 2);
        }
        this.mLookPosition += this.arrowOffset;
        this.mPaint.setShadowLayer((float) this.mShadowRadius, (float) this.mShadowX, (float) this.mShadowY, this.mShadowColor);
        this.mBubbleBorderPaint.setColor(this.mBubbleBorderColor);
        this.mBubbleBorderPaint.setStrokeWidth((float) this.mBubbleBorderSize);
        this.mBubbleBorderPaint.setStyle(Paint.Style.STROKE);
        int i3 = this.mShadowRadius;
        int i4 = this.mShadowX;
        int i5 = 0;
        this.mLeft = i3 + (i4 < 0 ? -i4 : 0) + (this.mLook == Look.LEFT ? this.mLookLength : 0);
        int i6 = this.mShadowRadius;
        int i7 = this.mShadowY;
        this.mTop = i6 + (i7 < 0 ? -i7 : 0) + (this.mLook == Look.TOP ? this.mLookLength : 0);
        int i8 = this.mWidth - this.mShadowRadius;
        int i9 = this.mShadowX;
        this.mRight = (i8 + (i9 > 0 ? -i9 : 0)) - (this.mLook == Look.RIGHT ? this.mLookLength : 0);
        int i10 = this.mHeight - this.mShadowRadius;
        int i11 = this.mShadowY;
        int i12 = i10 + (i11 > 0 ? -i11 : 0);
        if (this.mLook == Look.BOTTOM) {
            i5 = this.mLookLength;
        }
        this.mBottom = i12 - i5;
        this.mPaint.setColor(this.mBubbleColor);
        this.mPath.reset();
        int i13 = this.mLookPosition;
        int i14 = this.mLookLength + i13;
        int i15 = this.mBottom;
        if (i14 > i15) {
            i13 = i15 - this.mLookWidth;
        }
        int max = Math.max(i13, this.mShadowRadius);
        int i16 = this.mLookPosition;
        int i17 = this.mLookLength + i16;
        int i18 = this.mRight;
        if (i17 > i18) {
            i16 = i18 - this.mLookWidth;
        }
        int max2 = Math.max(i16, this.mShadowRadius);
        int i19 = this.mLook.ordinal();
        if (i19 == 1) {
            int ldr = getLDR();
            int i20 = this.mArrowDownRightRadius;
            if (max2 >= ldr + i20) {
                this.mPath.moveTo((float) (max2 - i20), (float) this.mBottom);
                Path path = this.mPath;
                int i21 = this.mArrowDownRightRadius;
                int i22 = this.mLookWidth;
                float f = ((((float) i22) / 2.0f) - ((float) this.mArrowTopRightRadius)) + ((float) i21);
                int i23 = this.mLookLength;
                path.rCubicTo((float) i21, 0.0f, f, (float) i23, (((float) i22) / 2.0f) + ((float) i21), (float) i23);
            } else {
                this.mPath.moveTo(((float) max2) + (((float) this.mLookWidth) / 2.0f), (float) (this.mBottom + this.mLookLength));
            }
            int i24 = this.mLookWidth + max2;
            int rdr = this.mRight - getRDR();
            int i25 = this.mArrowDownLeftRadius;
            if (i24 < rdr - i25) {
                Path path2 = this.mPath;
                float f2 = (float) this.mArrowTopLeftRadius;
                int i26 = this.mLookWidth;
                int i27 = this.mLookLength;
                path2.rCubicTo(f2, 0.0f, ((float) i26) / 2.0f, (float) (-i27), (((float) i26) / 2.0f) + ((float) i25), (float) (-i27));
                this.mPath.lineTo((float) (this.mRight - getRDR()), (float) this.mBottom);
            }
            Path path3 = this.mPath;
            int i28 = this.mRight;
            int i29 = this.mBottom;
            path3.quadTo((float) i28, (float) i29, (float) i28, (float) (i29 - getRDR()));
            this.mPath.lineTo((float) this.mRight, (float) (this.mTop + getRTR()));
            Path path4 = this.mPath;
            int i30 = this.mRight;
            path4.quadTo((float) i30, (float) this.mTop, (float) (i30 - getRTR()), (float) this.mTop);
            this.mPath.lineTo((float) (this.mLeft + getLTR()), (float) this.mTop);
            Path path5 = this.mPath;
            int i31 = this.mLeft;
            int i32 = this.mTop;
            path5.quadTo((float) i31, (float) i32, (float) i31, (float) (i32 + getLTR()));
            this.mPath.lineTo((float) this.mLeft, (float) (this.mBottom - getLDR()));
            if (max2 >= getLDR() + this.mArrowDownRightRadius) {
                Path path6 = this.mPath;
                int i33 = this.mLeft;
                path6.quadTo((float) i33, (float) this.mBottom, (float) (i33 + getLDR()), (float) this.mBottom);
            } else {
                int i34 = this.mBottom;
                this.mPath.quadTo((float) this.mLeft, (float) i34, ((float) max2) + (((float) this.mLookWidth) / 2.0f), (float) (i34 + this.mLookLength));
            }
        } else if (i19 == 2) {
            int ltr = getLTR();
            int i35 = this.mArrowDownLeftRadius;
            if (max2 >= ltr + i35) {
                this.mPath.moveTo((float) (max2 - i35), (float) this.mTop);
                Path path7 = this.mPath;
                int i36 = this.mArrowDownLeftRadius;
                int i37 = this.mLookWidth;
                float f3 = ((((float) i37) / 2.0f) - ((float) this.mArrowTopLeftRadius)) + ((float) i36);
                int i38 = this.mLookLength;
                path7.rCubicTo((float) i36, 0.0f, f3, (float) (-i38), (((float) i37) / 2.0f) + ((float) i36), (float) (-i38));
            } else {
                this.mPath.moveTo(((float) max2) + (((float) this.mLookWidth) / 2.0f), (float) (this.mTop - this.mLookLength));
            }
            int i39 = this.mLookWidth + max2;
            int rtr = this.mRight - getRTR();
            int i40 = this.mArrowDownRightRadius;
            if (i39 < rtr - i40) {
                Path path8 = this.mPath;
                float f4 = (float) this.mArrowTopRightRadius;
                int i41 = this.mLookWidth;
                int i42 = this.mLookLength;
                path8.rCubicTo(f4, 0.0f, ((float) i41) / 2.0f, (float) i42, (((float) i41) / 2.0f) + ((float) i40), (float) i42);
                this.mPath.lineTo((float) (this.mRight - getRTR()), (float) this.mTop);
            }
            Path path9 = this.mPath;
            int i43 = this.mRight;
            int i44 = this.mTop;
            path9.quadTo((float) i43, (float) i44, (float) i43, (float) (i44 + getRTR()));
            this.mPath.lineTo((float) this.mRight, (float) (this.mBottom - getRDR()));
            Path path10 = this.mPath;
            int i45 = this.mRight;
            path10.quadTo((float) i45, (float) this.mBottom, (float) (i45 - getRDR()), (float) this.mBottom);
            this.mPath.lineTo((float) (this.mLeft + getLDR()), (float) this.mBottom);
            Path path11 = this.mPath;
            int i46 = this.mLeft;
            int i47 = this.mBottom;
            path11.quadTo((float) i46, (float) i47, (float) i46, (float) (i47 - getLDR()));
            this.mPath.lineTo((float) this.mLeft, (float) (this.mTop + getLTR()));
            if (max2 >= getLTR() + this.mArrowDownLeftRadius) {
                Path path12 = this.mPath;
                int i48 = this.mLeft;
                path12.quadTo((float) i48, (float) this.mTop, (float) (i48 + getLTR()), (float) this.mTop);
            } else {
                int i49 = this.mTop;
                this.mPath.quadTo((float) this.mLeft, (float) i49, ((float) max2) + (((float) this.mLookWidth) / 2.0f), (float) (i49 - this.mLookLength));
            }
        } else if (i19 == 3) {
            int ltr2 = getLTR();
            int i50 = this.mArrowDownRightRadius;
            if (max >= ltr2 + i50) {
                this.mPath.moveTo((float) this.mLeft, (float) (max - i50));
                Path path13 = this.mPath;
                int i51 = this.mArrowDownRightRadius;
                int i52 = this.mLookLength;
                int i53 = this.mLookWidth;
                path13.rCubicTo(0.0f, (float) i51, (float) (-i52), ((float) i51) + ((((float) i53) / 2.0f) - ((float) this.mArrowTopRightRadius)), (float) (-i52), (((float) i53) / 2.0f) + ((float) i51));
            } else {
                this.mPath.moveTo((float) (this.mLeft - this.mLookLength), ((float) max) + (((float) this.mLookWidth) / 2.0f));
            }
            int i54 = this.mLookWidth + max;
            int ldr2 = this.mBottom - getLDR();
            int i55 = this.mArrowDownLeftRadius;
            if (i54 < ldr2 - i55) {
                Path path14 = this.mPath;
                float f5 = (float) this.mArrowTopLeftRadius;
                int i56 = this.mLookLength;
                int i57 = this.mLookWidth;
                path14.rCubicTo(0.0f, f5, (float) i56, ((float) i57) / 2.0f, (float) i56, (((float) i57) / 2.0f) + ((float) i55));
                this.mPath.lineTo((float) this.mLeft, (float) (this.mBottom - getLDR()));
            }
            Path path15 = this.mPath;
            int i58 = this.mLeft;
            path15.quadTo((float) i58, (float) this.mBottom, (float) (i58 + getLDR()), (float) this.mBottom);
            this.mPath.lineTo((float) (this.mRight - getRDR()), (float) this.mBottom);
            Path path16 = this.mPath;
            int i59 = this.mRight;
            int i60 = this.mBottom;
            path16.quadTo((float) i59, (float) i60, (float) i59, (float) (i60 - getRDR()));
            this.mPath.lineTo((float) this.mRight, (float) (this.mTop + getRTR()));
            Path path17 = this.mPath;
            int i61 = this.mRight;
            path17.quadTo((float) i61, (float) this.mTop, (float) (i61 - getRTR()), (float) this.mTop);
            this.mPath.lineTo((float) (this.mLeft + getLTR()), (float) this.mTop);
            if (max >= getLTR() + this.mArrowDownRightRadius) {
                Path path18 = this.mPath;
                int i62 = this.mLeft;
                int i63 = this.mTop;
                path18.quadTo((float) i62, (float) i63, (float) i62, (float) (i63 + getLTR()));
            } else {
                Path path19 = this.mPath;
                int i64 = this.mLeft;
                path19.quadTo((float) i64, (float) this.mTop, (float) (i64 - this.mLookLength), ((float) max) + (((float) this.mLookWidth) / 2.0f));
            }
        } else if (i19 == 4) {
            int rtr2 = getRTR();
            int i65 = this.mArrowDownLeftRadius;
            if (max >= rtr2 + i65) {
                this.mPath.moveTo((float) this.mRight, (float) (max - i65));
                Path path20 = this.mPath;
                int i66 = this.mArrowDownLeftRadius;
                int i67 = this.mLookLength;
                int i68 = this.mLookWidth;
                path20.rCubicTo(0.0f, (float) i66, (float) i67, ((float) i66) + ((((float) i68) / 2.0f) - ((float) this.mArrowTopLeftRadius)), (float) i67, (((float) i68) / 2.0f) + ((float) i66));
            } else {
                this.mPath.moveTo((float) (this.mRight + this.mLookLength), ((float) max) + (((float) this.mLookWidth) / 2.0f));
            }
            int i69 = this.mLookWidth + max;
            int rdr2 = this.mBottom - getRDR();
            int i70 = this.mArrowDownRightRadius;
            if (i69 < rdr2 - i70) {
                Path path21 = this.mPath;
                float f6 = (float) this.mArrowTopRightRadius;
                int i71 = this.mLookLength;
                int i72 = this.mLookWidth;
                path21.rCubicTo(0.0f, f6, (float) (-i71), ((float) i72) / 2.0f, (float) (-i71), (((float) i72) / 2.0f) + ((float) i70));
                this.mPath.lineTo((float) this.mRight, (float) (this.mBottom - getRDR()));
            }
            Path path22 = this.mPath;
            int i73 = this.mRight;
            path22.quadTo((float) i73, (float) this.mBottom, (float) (i73 - getRDR()), (float) this.mBottom);
            this.mPath.lineTo((float) (this.mLeft + getLDR()), (float) this.mBottom);
            Path path23 = this.mPath;
            int i74 = this.mLeft;
            int i75 = this.mBottom;
            path23.quadTo((float) i74, (float) i75, (float) i74, (float) (i75 - getLDR()));
            this.mPath.lineTo((float) this.mLeft, (float) (this.mTop + getLTR()));
            Path path24 = this.mPath;
            int i76 = this.mLeft;
            path24.quadTo((float) i76, (float) this.mTop, (float) (i76 + getLTR()), (float) this.mTop);
            this.mPath.lineTo((float) (this.mRight - getRTR()), (float) this.mTop);
            if (max >= getRTR() + this.mArrowDownLeftRadius) {
                Path path25 = this.mPath;
                int i77 = this.mRight;
                int i78 = this.mTop;
                path25.quadTo((float) i77, (float) i78, (float) i77, (float) (i78 + getRTR()));
            } else {
                Path path26 = this.mPath;
                int i79 = this.mRight;
                path26.quadTo((float) i79, (float) this.mTop, (float) (i79 + this.mLookLength), ((float) max) + (((float) this.mLookWidth) / 2.0f));
            }
        }
        this.mPath.close();
    }

    /* access modifiers changed from: protected */
    public void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        canvas.drawPath(this.mPath, this.mPaint);
        if (this.mBubbleImageBg != null) {
            this.mPath.computeBounds(this.mBubbleImageBgDstRectF, true);
            int saveLayer = canvas.saveLayer(this.mBubbleImageBgDstRectF, null, 31);
            canvas.drawPath(this.mPath, this.mBubbleImageBgBeforePaint);
            float width = this.mBubbleImageBgDstRectF.width() / this.mBubbleImageBgDstRectF.height();
            if (width > (((float) this.mBubbleImageBg.getWidth()) * 1.0f) / ((float) this.mBubbleImageBg.getHeight())) {
                int height = (int) ((((float) this.mBubbleImageBg.getHeight()) - (((float) this.mBubbleImageBg.getWidth()) / width)) / 2.0f);
                this.mBubbleImageBgSrcRect.set(0, height, this.mBubbleImageBg.getWidth(), ((int) (((float) this.mBubbleImageBg.getWidth()) / width)) + height);
            } else {
                int width2 = (int) ((((float) this.mBubbleImageBg.getWidth()) - (((float) this.mBubbleImageBg.getHeight()) * width)) / 2.0f);
                this.mBubbleImageBgSrcRect.set(width2, 0, ((int) (((float) this.mBubbleImageBg.getHeight()) * width)) + width2, this.mBubbleImageBg.getHeight());
            }
            canvas.drawBitmap(this.mBubbleImageBg, this.mBubbleImageBgSrcRect, this.mBubbleImageBgDstRectF, this.mBubbleImageBgPaint);
            canvas.restoreToCount(saveLayer);
        }
        if (this.mBubbleBorderSize != 0) {
            canvas.drawPath(this.mPath, this.mBubbleBorderPaint);
        }
    }

    public Paint getPaint() {
        return this.mPaint;
    }

    public Path getPath() {
        return this.mPath;
    }

    public Look getLook() {
        return this.mLook;
    }

    public int getLookPosition() {
        return this.mLookPosition;
    }

    public int getLookWidth() {
        return this.mLookWidth;
    }

    public int getLookLength() {
        return this.mLookLength;
    }

    public int getShadowColor() {
        return this.mShadowColor;
    }

    public int getShadowRadius() {
        return this.mShadowRadius;
    }

    public int getShadowX() {
        return this.mShadowX;
    }

    public int getShadowY() {
        return this.mShadowY;
    }

    public int getBubbleRadius() {
        return this.mBubbleRadius;
    }

    public int getBubbleColor() {
        return this.mBubbleColor;
    }

    public void setBubbleColor(int i) {
        this.mBubbleColor = i;
    }

    public void setLook(Look look) {
        this.mLook = look;
        initPadding();
    }

    public void setLookPosition(int i) {
        this.mLookPosition = i;
    }

    public void setLookPositionCenter(boolean z) {
        this.isLookPositionCenter = z;
    }

    public void setLookWidth(int i) {
        this.mLookWidth = i;
    }

    public void setLookLength(int i) {
        this.mLookLength = i;
        initPadding();
    }

    public void setShadowColor(int i) {
        this.mShadowColor = i;
    }

    public void setShadowRadius(int i) {
        this.mShadowRadius = i;
    }

    public void setShadowX(int i) {
        this.mShadowX = i;
    }

    public void setShadowY(int i) {
        this.mShadowY = i;
    }

    public void setBubbleRadius(int i) {
        this.mBubbleRadius = i;
    }

    public int getLTR() {
        int i = this.mLTR;
        return i == -1 ? this.mBubbleRadius : i;
    }

    public void setLTR(int i) {
        this.mLTR = i;
    }

    public int getRTR() {
        int i = this.mRTR;
        return i == -1 ? this.mBubbleRadius : i;
    }

    public void setRTR(int i) {
        this.mRTR = i;
    }

    public int getRDR() {
        int i = this.mRDR;
        return i == -1 ? this.mBubbleRadius : i;
    }

    public void setRDR(int i) {
        this.mRDR = i;
    }

    public int getLDR() {
        int i = this.mLDR;
        return i == -1 ? this.mBubbleRadius : i;
    }

    public void setLDR(int i) {
        this.mLDR = i;
    }

    public int getArrowTopLeftRadius() {
        return this.mArrowTopLeftRadius;
    }

    public void setArrowTopLeftRadius(int i) {
        this.mArrowTopLeftRadius = i;
    }

    public int getArrowTopRightRadius() {
        return this.mArrowTopRightRadius;
    }

    public void setArrowTopRightRadius(int i) {
        this.mArrowTopRightRadius = i;
    }

    public int getArrowDownLeftRadius() {
        return this.mArrowDownLeftRadius;
    }

    public void setArrowDownLeftRadius(int i) {
        this.mArrowDownLeftRadius = i;
    }

    public int getArrowDownRightRadius() {
        return this.mArrowDownRightRadius;
    }

    public void setArrowDownRightRadius(int i) {
        this.mArrowDownRightRadius = i;
    }

    public void setArrowRadius(int i) {
        setArrowDownLeftRadius(i);
        setArrowDownRightRadius(i);
        setArrowTopLeftRadius(i);
        setArrowTopRightRadius(i);
    }

    public void setBubblePadding(int i) {
        this.mBubblePadding = i;
    }

    public void setBubbleImageBg(Bitmap bitmap) {
        this.mBubbleImageBg = bitmap;
    }

    public void setBubbleImageBgRes(int i) {
        this.mBubbleImageBg = BitmapFactory.decodeResource(getResources(), i);
    }

    public void setBubbleBorderSize(int i) {
        this.mBubbleBorderSize = i;
    }

    public void setBubbleBorderColor(int i) {
        this.mBubbleBorderColor = i;
    }

    public Parcelable onSaveInstanceState() {
        Bundle bundle = new Bundle();
        bundle.putParcelable("instanceState", super.onSaveInstanceState());
        bundle.putInt("mLookPosition", this.mLookPosition);
        bundle.putInt("mLookWidth", this.mLookWidth);
        bundle.putInt("mLookLength", this.mLookLength);
        bundle.putInt("mShadowColor", this.mShadowColor);
        bundle.putInt("mShadowRadius", this.mShadowRadius);
        bundle.putInt("mShadowX", this.mShadowX);
        bundle.putInt("mShadowY", this.mShadowY);
        bundle.putInt("mBubbleRadius", this.mBubbleRadius);
        bundle.putInt("mLTR", this.mLTR);
        bundle.putInt("mRTR", this.mRTR);
        bundle.putInt("mRDR", this.mRDR);
        bundle.putInt("mLDR", this.mLDR);
        bundle.putInt("mBubblePadding", this.mBubblePadding);
        bundle.putInt("mArrowTopLeftRadius", this.mArrowTopLeftRadius);
        bundle.putInt("mArrowTopRightRadius", this.mArrowTopRightRadius);
        bundle.putInt("mArrowDownLeftRadius", this.mArrowDownLeftRadius);
        bundle.putInt("mArrowDownRightRadius", this.mArrowDownRightRadius);
        bundle.putInt("mWidth", this.mWidth);
        bundle.putInt("mHeight", this.mHeight);
        bundle.putInt("mLeft", this.mLeft);
        bundle.putInt("mTop", this.mTop);
        bundle.putInt("mRight", this.mRight);
        bundle.putInt("mBottom", this.mBottom);
        bundle.putInt("mBubbleBgRes", this.mBubbleBgRes);
        bundle.putInt("mBubbleBorderColor", this.mBubbleBorderColor);
        bundle.putInt("mBubbleBorderSize", this.mBubbleBorderSize);
        return bundle;
    }

    public void onRestoreInstanceState(Parcelable parcelable) {
        if (parcelable instanceof Bundle) {
            Bundle bundle = (Bundle) parcelable;
            this.mLookPosition = bundle.getInt("mLookPosition");
            this.mLookWidth = bundle.getInt("mLookWidth");
            this.mLookLength = bundle.getInt("mLookLength");
            this.mShadowColor = bundle.getInt("mShadowColor");
            this.mShadowRadius = bundle.getInt("mShadowRadius");
            this.mShadowX = bundle.getInt("mShadowX");
            this.mShadowY = bundle.getInt("mShadowY");
            this.mBubbleRadius = bundle.getInt("mBubbleRadius");
            this.mLTR = bundle.getInt("mLTR");
            this.mRTR = bundle.getInt("mRTR");
            this.mRDR = bundle.getInt("mRDR");
            this.mLDR = bundle.getInt("mLDR");
            this.mBubblePadding = bundle.getInt("mBubblePadding");
            this.mArrowTopLeftRadius = bundle.getInt("mArrowTopLeftRadius");
            this.mArrowTopRightRadius = bundle.getInt("mArrowTopRightRadius");
            this.mArrowDownLeftRadius = bundle.getInt("mArrowDownLeftRadius");
            this.mArrowDownRightRadius = bundle.getInt("mArrowDownRightRadius");
            this.mWidth = bundle.getInt("mWidth");
            this.mHeight = bundle.getInt("mHeight");
            this.mLeft = bundle.getInt("mLeft");
            this.mTop = bundle.getInt("mTop");
            this.mRight = bundle.getInt("mRight");
            this.mBottom = bundle.getInt("mBottom");
            int i = bundle.getInt("mBubbleBgRes");
            this.mBubbleBgRes = i;
            if (i != -1) {
                this.mBubbleImageBg = BitmapFactory.decodeResource(getResources(), this.mBubbleBgRes);
            }
            this.mBubbleBorderSize = bundle.getInt("mBubbleBorderSize");
            this.mBubbleBorderColor = bundle.getInt("mBubbleBorderColor");
            super.onRestoreInstanceState(bundle.getParcelable("instanceState"));
            return;
        }
        super.onRestoreInstanceState(parcelable);
    }
}
